/*
 * @Description: 
 * @Date: 2022-02-18 10:01:24
 * @Author: caikaixuan
 * @LastEditTime: 2022-02-18 11:00:27
 */
const fs = require("fs");
const path = require("path");

async function HomeIndex(ctx,next){
    const homePage = fs.readFileSync(path.join(__dirname, "../../index.html"), "utf-8");
    ctx.response.body = homePage;
}

async function WXOpenId(ctx,next){
    if (ctx.request.headers["x-wx-source"]) {
        const openid = ctx.request.headers["x-wx-openid"];
        ctx.rest(openid);
    }else{
        ctx.rest("not found");
    }
}


module.exports = {
    'GET /': HomeIndex,
    'GET /api/wx_openid':WXOpenId
};